home *** CD-ROM | disk | FTP | other *** search
- unit Ufmgr17;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, ShellAPI, FileCtrl,
- DRWSUtl1, DRWSUtl3;
-
- type
- TCCFileMgrForm = class(TForm)
- Panel1: TPanel;
- Panel2: TPanel;
- BitBtn1: TBitBtn;
- Panel3: TPanel;
- Label1: TLabel;
- BitBtn2: TBitBtn;
- BitBtn3: TBitBtn;
- BitBtn4: TBitBtn;
- BitBtn5: TBitBtn;
- BitBtn6: TBitBtn;
- BitBtn7: TBitBtn;
- OpenDialog1: TOpenDialog;
- BitBtn8: TBitBtn;
- BitBtn9: TBitBtn;
- OpenDialog2: TOpenDialog;
- BitBtn10: TBitBtn;
- Panel4: TPanel;
- Panel5: TPanel;
- Panel6: TPanel;
- Panel7: TPanel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- procedure FormResize(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure BitBtn7Click(Sender: TObject);
- procedure BitBtn1Click(Sender: TObject);
- procedure BitBtn2Click(Sender: TObject);
- procedure BitBtn3Click(Sender: TObject);
- procedure BitBtn4Click(Sender: TObject);
- procedure BitBtn5Click(Sender: TObject);
- procedure FormPaint(Sender: TObject);
- procedure BitBtn8Click(Sender: TObject);
- procedure BitBtn9Click(Sender: TObject);
- procedure BitBtn6Click(Sender: TObject);
- procedure BitBtn1DragDrop(Sender, Source: TObject; X, Y: Integer);
- procedure BitBtn1DragOver(Sender, Source: TObject; X, Y: Integer;
- State: TDragState; var Accept: Boolean);
- procedure BitBtn2DragDrop(Sender, Source: TObject; X, Y: Integer);
- procedure BitBtn3DragDrop(Sender, Source: TObject; X, Y: Integer);
- procedure BitBtn4DragDrop(Sender, Source: TObject; X, Y: Integer);
- procedure BitBtn10Click(Sender: TObject);
- procedure FormDestroy(Sender: TObject);
- procedure FormKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure BitBtn9KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- procedure Label2Click(Sender: TObject);
- procedure Label3Click(Sender: TObject);
- procedure Label4Click(Sender: TObject);
- procedure Panel2MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure Panel4MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure Panel3MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn1MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn2MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn3MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn4MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn5MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn8MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn9MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn6MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn7MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure BitBtn10MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure Panel5MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure Panel6MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure Panel7MouseMove(Sender: TObject; Shift: TShiftState; X,
- Y: Integer);
- procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure BitBtn2MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure BitBtn3MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- procedure BitBtn4MouseUp(Sender: TObject; Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- private
- { Private declarations }
- public
- { Public declarations }
- DirectoryListBox1 : TDirectoryListBox;
- FileListBox1 : TIconFileListBox;
- ScrollBox1 : TFileIconPanelScrollbox;
- end;
- var
- CCFileMgrForm : TCCFileMgrForm;
- CurrentView : Integer; { This holds the current view setting }
-
- implementation
-
- {$R *.DFM}
-
- uses DDDFUnit, { Include custom directory selection form }
- CfmpfUn; { Include custom options dialog }
-
- { Set up the resize to replace the icon buttons }
- procedure TCCFileMgrForm.FormResize(Sender: TObject);
- begin
- { Send in the panel and global buttons list }
- SpacePanelButtons( Panel2 );
- end;
-
- { Delphi wrote this; use it to set everything up }
- procedure TCCFileMgrForm.FormCreate(Sender: TObject);
- var TheIconPanel : TFileIconPanel;
- CurrentPath : String;
- begin
- { Create the directory list box }
- SavedForm := Self;
- DirectoryListBox1 := TDirectoryListBox.Create( Panel1 );
- DirectoryListBox1.Parent := Panel1;
- DirectoryListBox1.Visible := true;
- DirectoryListbox1.Top := 17;
- DirectoryListbox1.Left := 0;
- DirectoryListbox1.Height := Panel1.Height - 32;
- DirectoryListbox1.Width := 0;
- { Create the file list box }
- FileListBox1 := TIconFileListBox.Create( Panel1 );
- FileListBox1.Parent := Panel1;
- FileListbox1.Top := 17;
- FileListbox1.Left := 146;
- FileListbox1.Height := Panel1.Height - 32;
- FileListbox1.Width := 0;
- FileListBox1.Visible := true;
- FileListBox1.ShowGlyphs := true;
- FileListBox1.MultiSelect := true;
- FileListBox1.DragMode := dmAutomatic;
- { Set intercomponent interactions }
- DirectoryListBox1.FileList := FileListbox1;
- DirectoryListBox1.DirLabel := Label1;
- { Create the scrollbox }
- ScrollBox1 := TFileIconPanelScrollBox.Create( Panel1 );
- ScrollBox1.Parent := Panel1;
- ScrollBox1.align := alClient;
- ScrollBox1.Left := 0;
- ScrollBox1.Top := 0;
- ScrollBox1.Width := Panel1.Width - 32;
- ScrollBox1.Height := Panel1.Height - 32;
- ScrollBox1.IconsNeedRefreshing := false;
- ScrollBox1.TheStoredHandle := Self.Handle;
- ScrollBox1.TheParentForm := Self;
- { Get the current directory with 0 parameter }
- GetDir( 0 , CurrentPath );
- { Set the display caption }
- Label1.Caption := CurrentPath;
- { Add a trailing \ if not root }
- CurrentPath := ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentPath );
- { Get the icons display using scrollbox1 }
- ScrollBox1.GetIconsForEntireDirectory( CurrentPath );
- { Set the Icon View as default }
- CurrentView := 1;
- { Start the FIP IOManager }
- if not assigned( TheIOManager ) then
- begin
- TheIOManager := TIOManager.Create( Self );
- TheIOManager.Parent := Self;
- TheIOManager.InitLocks;
- end;
- if not Assigned( TheMouseManager ) then
- begin
- TheMouseManager := TMouseManager.Create( Self );
- TheMouseManager.InitializeNormal;
- end;
- { Load the special cursor to toggle the LOCK keys }
- Screen.Cursors[ CR_KEYSET ] := LoadCursor( hInstance , 'KEYSET' );
- Screen.Cursors[ CR_NULL ] := LoadCursor( hInstance , 'BLANKCUR' );
- Panel5.Cursor := CR_KEYSET;
- Panel6.Cursor := CR_KEYSET;
- Panel7.Cursor := CR_KEYSET;
- Label2.Visible := TheIOManager.IsCapsLockDown;
- Label3.Visible := TheIOManager.IsNumLockDown;
- Label4.Visible := TheIOManager.IsScrollLockDown;
- end;
-
- { Delphi wrote this; use it to close the application }
- procedure TCCFileMgrForm.BitBtn7Click(Sender: TObject);
- begin
- Close;
- end;
-
- { Delphi wrote this use it to perform a copy on all selected files }
- procedure TCCFileMgrForm.BitBtn1Click(Sender: TObject);
- var ThePosition : Integer; { Loop counter }
- CurrentName , { Holds work name}
- TheOldString : String; { Holds Dir }
- finished : Boolean; { Loop control }
- WorkingDir : String; { Holds mod wd }
- TargetDir : String; { target of op }
- TheResult : Integer; { Modal res hold }
- begin
- { Get current directory and save it for later }
- GetDir( 0 , TheOldString );
- { Check for need to add trailing \ }
- WorkingDir := TheOldString;
- WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
- { Display the Windows-based directory input form }
- TheResult := DestDDForm.ShowModal;
- { If not cancelled do the copy }
- if TheResult = mrOK then
- begin
- { Get the target directory with \ OK }
- TargetDir := DestDDForm.GetTargetDirectory;
- { Show the hourglass to indicate waiting }
- Screen.Cursor := crHourGlass;
- { Setup to get all selections }
- ThePosition := 1;
- finished := false;
- while not finished do
- begin
- { Call generic file getting routine based on current view}
- case CurrentView of
- 1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- 2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- end;
- { If returns blank string out of selections so exit }
- if CurrentName = '' then finished := true else
- begin
- { If a directory signal error }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
- +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
- begin
- ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
- TargetDir );
- end;
- end
- else
- begin
- Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
- end;
- end;
- end;
- { Reset to normal cursor }
- Screen.Cursor := crDefault;
- end;
- { Reset to the original directory }
- ChDir( TheOldString );
- end;
-
- { Delphi wrote this, use it to move files which are selected }
- procedure TCCFileMgrForm.BitBtn2Click(Sender: TObject);
- var ThePosition : Integer; { Loop counter }
- CurrentName , { Holds work name}
- TheOldString : String; { Holds Dir }
- finished : Boolean; { Loop control }
- WorkingDir : String; { Holds mod wd }
- TargetDir : String; { target of op }
- TheResult : Integer; { Modal res hold }
- begin
- { Get current directory and save it for later }
- GetDir( 0 , TheOldString );
- { Check for need to add trailing \ }
- WorkingDir := TheOldString;
- WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
- { Display the Windows-based directory input form }
- TheResult := DestDDForm.ShowModal;
- { If not cancelled do the copy }
- if TheResult = mrOK then
- begin
- { Get the target directory with \ OK }
- TargetDir := DestDDForm.GetTargetDirectory;
- { Show the hourglass to indicate waiting }
- Screen.Cursor := crHourGlass;
- { Set up to get all current selections }
- ThePosition := 1;
- finished := false;
- while not finished do
- begin
- { Call generic file getting routine based on current view}
- case CurrentView of
- 1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- 2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- end;
- { If returns blank string then out of selections }
- if CurrentName = '' then finished := true else
- begin
- { If a directory signal error }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
- '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
- ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
- TargetDir );
- end
- else
- begin
- Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
- end;
- end;
- { Reset to normal cursor }
- Screen.Cursor := crDefault;
- end;
- end;
- { Reset to the original directory }
- ChDir( TheOldString );
- if CurrentView = 1 then { Reset icon display if in view }
- ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
- end;
-
- { Delphi wrote this, use it to delete files which are selected }
- procedure TCCFileMgrForm.BitBtn3Click(Sender: TObject);
- var ThePosition : Integer; { Loop counter }
- CurrentName , { Holds work name}
- TheOldString : String; { Holds Dir }
- finished : Boolean; { Loop control }
- WorkingDir : String; { Holds mod wd }
- begin
- { Get current directory and save it for later }
- GetDir( 0 , TheOldString );
- { Check for need to add trailing \ }
- WorkingDir := TheOldString;
- WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
- { Set up to do loop for selected files }
- ThePosition := 1;
- finished := false;
- while not finished do
- begin
- { Call generic file getting routine based on current view}
- case CurrentView of
- 1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- 2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- end;
- { if returns blank string out of selections }
- if CurrentName = '' then finished := true else
- begin
- { If its a directory signal error }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation,
- mbYesNoCancel , 0 ) = mrYes then
- begin
- ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
- Scrollbox1.TheFWB.RemoveDirectory( Currentname );
- end;
- end
- else
- begin
- { Otherwise get confirmation message and if OKed delete file }
- if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
- mbYesNoCancel , 0 ) = mrYes then
- begin
- ScrollBox1.TheFWB.DeleteTheFile( Currentname );
- end;
- end;
- end;
- end;
- if CurrentView = 1 then { Reset icon display if in view }
- ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
- end;
-
- { Delphi wrote this; use it to rename selected files }
- procedure TCCFileMgrForm.BitBtn4Click(Sender: TObject);
- var ThePosition : Integer; { Loop counter }
- CurrentName , { Holds work name}
- TheOldString : String; { Holds Dir }
- finished : Boolean; { Loop control }
- WorkingDir : String; { Holds mod wd }
- begin
- { Get current directory for later }
- GetDir( 0 , TheOldString );
- { Check for need to add trailing \ }
- WorkingDir := TheOldString;
- WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
- { Set up to do loop for selected files }
- ThePosition := 1;
- finished := false;
- while not finished do
- begin
- { Call generic file getting routine based on current view}
- case CurrentView of
- 1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- 2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- end;
- { If returns blank string then out of selections }
- if CurrentName = '' then finished := true else
- begin
- { Otherwise set up the opendialog with filename and caption }
- OpenDialog1.Filename := ExtractFilename( CurrentName );
- { Use this to prevent error from changing directories }
- OpenDialog1.Options := [ofNoChangeDir];
- OpenDialog1.Title := 'Rename File';
- { If not cancelled then do rename or signal error }
- if OpenDialog1.Execute then
- begin
- ScrollBox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
- end;
- end;
- end;
- if CurrentView = 1 then { Reset icon display if in view }
- ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
- end;
-
- { Delphi wrote this; use it to make a new directory under current one }
- procedure TCCFileMgrForm.BitBtn5Click(Sender: TObject);
- begin
- { Set up the dialog to get the new directory name }
- OpenDialog2.FileName := '*.*';
- OpenDialog2.Title := 'Enter Directory Name';
- if OpenDialog1.Execute then
- begin
- { If not cancelled make new directory }
- Scrollbox1.TheFWB.CreateNewDirectory( OpenDialog1.Filename );
- end;
- if CurrentView = 1 then { Reset icon display if in view }
- ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
- end;
-
- { Delphi wrote this; use it to handle refreshing the scrollbox }
- procedure TCCFileMgrForm.FormPaint(Sender: TObject);
- var CurrentDirectory : String; { Get current dir }
- begin
- { If updated, do refresh }
- if ScrollBox1.IconsNeedRefreshing then
- begin
- Scrollbox1.ClearTheFIPs;
- ScrollBox1.IconsNeedRefreshing := false;
- GetDir( 0 , CurrentDirectory );
- { Force trailing backslash }
- CurrentDirectory := ScrollBox1.TheFWB.ForceTrailingBackSlash(
- CurrentDirectory );
- { Set the label to the new directory }
- Label1.Caption := UpperCase( CurrentDirectory );
- { Do the update }
- ScrollBox1.GetIconsForEntireDirectory( CurrentDirectory );
- end;
- end;
-
- { Delphi wrote this; use it to reset the current view Icons/List }
- procedure TCCFileMgrForm.BitBtn8Click(Sender: TObject);
- var TheOldString : String; { Use to get current directory }
- begin
- { Reset currentview }
- if CurrentView = 1 then CurrentView := 2 else
- CurrentView := 1;
- { either show the windows boxes or the scrollbox }
- case CurrentView of
- 1 : begin
- { Make the listboxes invisible by changing align and width }
- FileListBox1.Visible := false;
- FileListBox1.Align := alNone;
- FileListBox1.Width := 0;
- DirectoryListBox1.Visible := false;
- DirectoryListBox1.align := alNone;
- DirectoryListBox1.Width := 0;
- { Keep them from getting mouse clicks }
- FileListBox1.Enabled := false;
- DirectoryListBox1.Enabled := false;
- { Have the scrollbox get mouse and be seen by resetting align/wid}
- Scrollbox1.align := alClient;
- Scrollbox1.width := Panel1.Width - 32;
- ScrollBox1.Enabled := true;
- { Tell the scrollbox to repaint itself just in case }
- ScrollBox1.Update;
- end;
- 2 : begin
- { Make the listboxes visible by resetting align and width}
- FileListBox1.Visible := true;
- DirectoryListBox1.Visible := true;
- DirectoryListBox1.width := 145;
- DirectoryListBox1.align := alLeft;
- FileListBox1.align := alClient;
- FileListBox1.Width := Panel1.Width - 32 - DirectoryListBox1.Width;
- { Have them getting mouse clicks }
- FileListBox1.Enabled := true;
- DirectoryListBox1.Enabled := true;
- { Have the scrollbox not get mouse and not be seen via align/width}
- ScrollBox1.Enabled := false;
- ScrollBox1.Visible := false;
- ScrollBox1.align := alNone;
- ScrollBox1.Width := 0;
- end;
- end;
- Invalidate;
- end;
-
- { Delphi wrote this; use it to do a file search display }
- procedure TCCFileMgrForm.BitBtn9Click(Sender: TObject);
- var CurrentDirectory : String; { Holds current directory }
- begin
- { Set up and run the search dialog }
- OpenDialog2.FileName := '*.*';
- { if not cancelled do the search }
- if OpenDialog2.Execute then
- begin
- { Get current directory }
- GetDir( 0 , CurrentDirectory );
- { Force trailing backslash }
- CurrentDirectory :=
- ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentDirectory );
- { display recursive search results }
- GlobalAbortFlag := false;
- Scrollbox1.DisplayRecursiveSearchResults(
- CurrentDirectory + ExtractFileName( OpenDialog2.Filename ));
- Label1.Caption := 'Search Results for ' + CurrentDirectory +
- ExtractFileName( OpenDialog2.FileName );
- end;
- end;
-
- { Delphi wrote this; use it to set a file's properties }
- procedure TCCFileMgrForm.BitBtn6Click(Sender: TObject);
- var ThePosition : Integer; { Loop counter }
- CurrentName , { Holds work name}
- TheOldString : String; { Holds Dir }
- finished : Boolean; { Loop control }
- WorkingDir : String; { Holds mod wd }
- begin
- { Get current directory for later }
- GetDir( 0 , TheOldString );
- ThePosition := 1;
- { Check for need to add trailing \ }
- Workingdir := TheOldString;
- WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
- { Call generic file getting routine based on current view}
- case CurrentView of
- 1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- 2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
- ThePosition );
- end;
- { If nothing selected then abort (gets ..!) }
- if CurrentName = '' then
- begin
- MessageDlg( 'No File Selected!' , mtError , [mbOK] , 0 );
- exit;
- end
- else
- begin
- { Otherwise set up the properties form and show it }
- CCFMPropsForm.WorkingFileName := CurrentName;
- CCFMPropsForm.ThePosition := ThePosition;
- CCFMPropsForm.BitBtn4.Enabled := true;
- CCFMPropsForm.Initialize;
- CCFMPropsForm.ShowModal;
- end;
- if CurrentView = 1 then { Reset icon display if in view }
- ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
- end;
-
- { Delphi wrote this; use it to drag and drop files for copying }
- procedure TCCFileMgrForm.BitBtn1DragDrop(Sender, Source: TObject; X,
- Y: Integer);
- var CurrentName , { Holds work name}
- WorkingDir ,
- TheOldString : String; { Holds Dir }
- TargetDir : String; { target of op }
- TheResult : Integer; { Modal res hold }
- Counter_1 : Integer;
- begin
- { Make sure source is indeed a FileIconPanel }
- if Source is TIconFileListbox then
- begin
- with Source as TIconFileListBox do
- begin
- { Get current directory and save it for later }
- GetDir( 0 , TheOldString );
- WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
- { Display the Windows-based directory input form }
- TheResult := DestDDForm.ShowModal;
- { If not cancelled do the copy }
- if TheResult = mrOK then
- begin
- for Counter_1 := 1 to Items.Count do
- begin
- if Selected[ Counter_1 - 1 ] then
- begin
- CurrentName := WorkingDIr + Items[ Counter_1 - 1 ];
- { Get the target directory with \ OK }
- TargetDir := DestDDForm.GetTargetDirectory;
- { If a directory signal and do recursive operation }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
- +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
- begin
- ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
- TargetDir );
- end;
- end
- else
- begin
- { Do the copy }
- Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
- end;
- { Reset to the original directory }
- ChDir( TheOldString );
- end;
- end;
- end;
- end;
- FileListBox1.Update;
- exit;
- end;
- if TheIOManager.WasSHIFTPressed then
- begin
- BitBtn1Click( Source );
- exit;
- end;
- with Source as TFileIconPanel do
- begin
- { Get current directory and save it for later }
- GetDir( 0 , TheOldString );
- { Display the Windows-based directory input form }
- TheResult := DestDDForm.ShowModal;
- { If not cancelled do the copy }
- if TheResult = mrOK then
- begin
- CurrentName := FTheName;
- { Get the target directory with \ OK }
- TargetDir := DestDDForm.GetTargetDirectory;
- { If a directory signal and do recursive operation }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
- +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
- begin
- ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
- TargetDir );
- end;
- end
- else
- begin
- { Do the copy }
- Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
- end;
- { Reset to the original directory }
- ChDir( TheOldString );
- end;
- end;
- end;
-
- { Delphi wrote this; use it to generically OK DnD from FIPs }
- procedure TCCFileMgrForm.BitBtn1DragOver(Sender, Source: TObject; X,
- Y: Integer; State: TDragState; var Accept: Boolean);
- begin
- { Only accept from FileIconPanel components }
- if ( Source is TFileIconPanel ) or
- ( Source is TIconFileListBox ) then Accept := true else Accept := false;
- end;
-
- { Delphi wrote this; use it to accept Drag and Drop moving }
- procedure TCCFileMgrForm.BitBtn2DragDrop(Sender, Source: TObject; X,
- Y: Integer);
- var CurrentName , { Holds work name}
- WorkingDir ,
- TheOldString : String; { Holds Dir }
- TargetDir : String; { target of op }
- TheResult : Integer; { Modal res hold }
- Counter_1 : Integer;
- begin
- { Make sure source is indeed a FileIconPanel }
- if Source is TIconFileListbox then
- begin
- with Source as TIconFileListBox do
- begin
- { Get current directory and save it for later }
- GetDir( 0 , TheOldString );
- WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
- { Display the Windows-based directory input form }
- TheResult := DestDDForm.ShowModal;
- for Counter_1 := 1 to Items.Count do
- begin
- if Selected[ Counter_1 - 1 ] then
- begin
- { If not cancelled do the copy }
- if TheResult = mrOK then
- begin
- CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
- { Get the target directory with \ OK }
- TargetDir := DestDDForm.GetTargetDirectory;
- { If a directory signal and do recursive operation }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir
- +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
- begin
- ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
- TargetDir );
- end;
- end
- else
- begin
- { Do the copy }
- Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
- end;
- { Reset to the original directory }
- ChDir( TheOldString );
- end;
- end;
- end;
- end;
- FileListBox1.Update;
- exit;
- end;
- if TheIOManager.WasSHIFTPressed then
- begin
- BitBtn2Click( Source );
- exit;
- end;
- with Source as TFileIconPanel do
- begin
- { Get current directory and save it for later }
- GetDir( 0 , TheOldString );
- { Display the Windows-based directory input form }
- TheResult := DestDDForm.ShowModal;
- { If not cancelled do the copy }
- if TheResult = mrOK then
- begin
- { Get the target directory with \ OK }
- TargetDir := DestDDForm.GetTargetDirectory;
- { If Copyfile returns false an error occurred }
- CurrentName := FTheName;
- { If a directory signal and do recursion }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
- '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
- ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
- TargetDir );
- end
- else
- begin { Do the move }
- Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
- ChDir( TheOldString );
- end;
- { Refresh display }
- ScrollBox1.Update;
- end;
- end;
- end;
-
- { Delphi wrote this; use it to do drag and drop deletes }
- procedure TCCFileMgrForm.BitBtn3DragDrop(Sender, Source: TObject; X,
- Y: Integer);
- var WorkingDir ,
- CurrentName : String; { Holds work name}
- Counter_1 : Integer;
- begin
- { Make sure source is indeed a FileIconPanel }
- if Source is TIconFileListbox then
- begin
- with Source as TIconFileListBox do
- begin
- GetDir( 0 , WorkingDir );
- WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
- for Counter_1 := 1 to Items.Count do
- begin
- if Selected[ Counter_1 - 1 ] then
- begin
- CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
- { If a directory signal and do recursive operation }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Delete Directory ' + CurrentName +'?',
- mtConfirmation , mbYesNoCancel , 0 ) = mryes then
- begin
- ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
- Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
- end;
- end
- else
- begin
- if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
- mbYesNoCancel , 0 ) = mrYes then
- begin
- Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
- end;
- end;
- end;
- end;
- end;
- FileListBox1.Update;
- exit;
- end;
- if TheIOManager.WasSHIFTPressed then
- begin
- BitBtn3Click( Source );
- exit;
- end;
- with Source as TFileIconPanel do
- begin
- CurrentName := FTheName;
- { If its a directory signal and do recursive delete }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
- mbYesNoCancel , 0 ) = mrYes then
- begin
- Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
- Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
- end;
- end
- else
- begin
- { Otherwise get confirmation message and if OKed delete file }
- if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
- mbYesNoCancel , 0 ) = mrYes then
- begin
- Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
- end;
- end;
- { Refresh Display }
- Scrollbox1.Update;
- end;
- end;
-
- { Delphi wrote this; use it to do drag and drop renames }
- procedure TCCFileMgrForm.BitBtn4DragDrop(Sender, Source: TObject; X,
- Y: Integer);
- var WorkingDir ,
- CurrentName : String; { Holds work name}
- Counter_1 : Integer;
- begin
- { Make sure source is indeed a FileIconPanel }
- if Source is TIconFileListbox then
- begin
- with Source as TIconFileListBox do
- begin
- GetDir( 0 , WorkingDir );
- WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
- for Counter_1 := 1 to Items.Count do
- begin
- if Selected[ Counter_1 - 1 ] then
- begin
- CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
- { Otherwise set up the opendialog with filename and caption }
- OpenDialog2.Filename := ExtractFilename( CurrentName );
- { Use this to prevent error from changing directories }
- OpenDialog2.Options := [ofNoChangeDir];
- OpenDialog2.Title := 'Rename File';
- { If not cancelled then do rename or signal error }
- if OpenDialog2.Execute then
- begin
- Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
- end;
- end;
- end;
- end;
- FileListBox1.Update;
- exit;
- end;
- if TheIOManager.WasSHIFTPressed then
- begin
- BitBtn4Click( Source );
- exit;
- end;
- with Source as TFileIconPanel do
- begin
- CurrentName := FTheName;
- { If a directory signal error }
- { Otherwise set up the opendialog with filename and caption }
- OpenDialog2.Filename := ExtractFilename( CurrentName );
- { Use this to prevent error from changing directories }
- OpenDialog2.Options := [ofNoChangeDir];
- OpenDialog2.Title := 'Rename File';
- { If not cancelled then do rename or signal error }
- if OpenDialog2.Execute then
- begin
- Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
- end;
- { Refresh the display }
- ScrollBox1.Update;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn10Click(Sender: TObject);
- var TheCCFMForm : TCCFileMgrForm;
- begin
- TheCCFMForm := TCCFileMgrForm.Create( Application );
- TheCCFMForm.Show;
- end;
-
- procedure TCCFileMgrForm.FormDestroy(Sender: TObject);
- begin
- { Release the IO Manager }
- if assigned( TheIOManager) then
- begin
- TheIOManager.Free;
- TheIOManager := nil;
- end;
- if Assigned( TheMouseManager ) then
- begin
- TheMouseManager.Free;
- TheMouseManager := nil;
- end;
- end;
-
- procedure TCCFileMgrForm.FormKeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- var S_lock , N_Lock , C_lock : Boolean;
- begin
- case Key of
- VK_Capital : begin
- TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
- C_Lock := not C_Lock;
- TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
- Label2.Visible := C_Lock;
- end;
- VK_End : begin
- ScrollBox1.VertScrollbar.Position :=
- ScrollBox1.VertScrollbar.Range;
- ScrollBox1.HorzScrollbar.Position :=
- ScrollBox1.HorzScrollBar.Range;
- end;
- VK_Home : begin
- ScrollBox1.VertScrollbar.Position := 0;
- ScrollBox1.HorzScrollbar.Position := 0;
- end;
- VK_Left : begin
- TheMouseManager.InitializeNormal;
- TheIOManager.WhichState := Shift;
- if TheIOManager.WasSHIFTPressed then
- TheMouseManager.MoveSmallJumpLeft else
- if TheIOManager.WasCTRLPressed then
- TheMouseManager.MoveLargeJumpLeft else
- TheMouseManager.MoveSinglePixelLeft;
- end;
- VK_Up : begin
- TheMouseManager.InitializeNormal;
- TheIOManager.WhichState := Shift;
- if TheIOManager.WasSHIFTPressed then
- TheMouseManager.MoveSmallJumpUP else
- if TheIOManager.WasCTRLPressed then
- TheMouseManager.MoveLargeJumpUp else
- TheMouseManager.MoveSinglePixelUp;
- end;
- VK_Right : begin
- TheMouseManager.InitializeNormal;
- TheIOManager.WhichState := Shift;
- if TheIOManager.WasSHIFTPressed then
- TheMouseManager.MoveSmallJumpRight else
- if TheIOManager.WasCTRLPressed then
- TheMouseManager.MoveLargeJumpRight else
- TheMouseManager.MoveSinglePixelRight;
- end;
- VK_Down : begin
- TheMouseManager.InitializeNormal;
- TheIOManager.WhichState := Shift;
- if TheIOManager.WasSHIFTPressed then
- TheMouseManager.MoveSmallJumpDown else
- if TheIOManager.WasCTRLPressed then
- TheMouseManager.MoveLargeJumpDown else
- TheMouseManager.MoveSinglePixelDown;
- end;
- VK_F1 : TheIOManager.OnF1Pressed( Sender , Key , Shift );
- VK_F2 : TheIOManager.OnF2Pressed( Sender , Key , Shift );
- VK_F3 : TheIOManager.OnF3Pressed( Sender , Key , Shift );
- VK_F4 : TheIOManager.OnF4Pressed( Sender , Key , Shift );
- VK_F5 : TheIOManager.OnF5Pressed( Sender , Key , Shift );
- VK_F6 : TheIOManager.OnF6Pressed( Sender , Key , Shift );
- VK_F7 : TheIOManager.OnF7Pressed( Sender , Key , Shift );
- VK_F8 : TheIOManager.OnF8Pressed( Sender , Key , Shift );
- VK_F9 : TheIOManager.OnF9Pressed( Sender , Key , Shift );
- VK_F10 : TheIOManager.OnF10Pressed( Sender , Key , Shift );
- VK_F11 : TheIOManager.OnF11Pressed( Sender , Key , Shift );
- VK_F12 : TheIOManager.OnF12Pressed( Sender , Key , Shift );
- VK_Numlock : Begin
- TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
- N_Lock := not N_Lock;
- TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
- Label3.Visible := N_Lock;
- end;
- VK_Scroll : Begin
- TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
- S_Lock := not S_Lock;
- TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
- Label4.Visible := S_Lock;
- end;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn9KeyDown(Sender: TObject; var Key: Word;
- Shift: TShiftState);
- begin
- case Key of
- VK_CANCEL : begin
- if MessageDlg( 'Control Break Pressed! Abort Search?',
- mtConfirmation,mbYesNoCancel,0) = mrYes
- then GlobalAbortFlag := true;
- end;
- end;
- end;
-
- procedure TCCFileMgrForm.Label2Click(Sender: TObject);
- var C_Lock , N_Lock , S_Lock : Boolean;
- begin
- TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
- C_Lock := not C_Lock;
- TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
- Label2.Visible := C_Lock;
- end;
-
- procedure TCCFileMgrForm.Label3Click(Sender: TObject);
- var C_Lock , N_Lock , S_Lock : Boolean;
- begin
- TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
- N_Lock := not N_Lock;
- TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
- Label3.Visible := N_Lock;
- end;
-
- procedure TCCFileMgrForm.Label4Click(Sender: TObject);
- var C_Lock , N_Lock , S_Lock : Boolean;
- begin
- TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
- S_Lock := not S_Lock;
- TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
- Label4.Visible := S_Lock;
- end;
-
- procedure TCCFileMgrForm.Panel2MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left;
- ThePoint.Y := Y + Panel2.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left;
- ThePoint.Y := Y + Panel2.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.Panel1MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel1.Left;
- ThePoint.Y := Y + Panel1.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel1.Left;
- ThePoint.Y := Y + Panel1.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.Panel4MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel4.Left;
- ThePoint.Y := Y + Panel4.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel4.Left;
- ThePoint.Y := Y + Panel4.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.Panel3MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel3.Left;
- ThePoint.Y := Y + Panel3.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel3.Left;
- ThePoint.Y := Y + Panel3.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn1MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn1.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn1.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MovebitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn2MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn2.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn2.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn3MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn3.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn3.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn4MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn4.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn4.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn5MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn5.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn5.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn8MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn8.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn8.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn9MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn9.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn9.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn6MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn6.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn6.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn7MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn7.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn7.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn10MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn10.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel2.Left + BitBtn10.Left;
- ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.Panel5MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel4.Left + Panel5.Left;
- ThePoint.Y := Y + Panel4.Top + Panel5.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel4.Left + Panel5.Left;
- ThePoint.Y := Y + Panel4.Top + Panel5.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.Panel6MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel4.Left + Panel6.Left;
- ThePoint.Y := Y + Panel4.Top + Panel6.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel4.Left + Panel6.Left;
- ThePoint.Y := Y + Panel4.Top + Panel6.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.Panel7MouseMove(Sender: TObject;
- Shift: TShiftState; X, Y: Integer);
- var ThePoint, TheOtherPoint : TPoint;
- begin
- if IconDragging then
- begin
- ThePoint.X := X + Panel4.Left + Panel7.Left;
- ThePoint.Y := Y + Panel4.Top + Panel7.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- if BitmapDragging then
- begin
- ThePoint.X := X + Panel4.Left + Panel7.Left;
- ThePoint.Y := Y + Panel4.Top + Panel7.Top;
- TheOtherPoint := ClientToScreen( ThePoint );
- TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
- exit;
- end;
- end;
-
- procedure TCCFileMgrForm.Panel1MouseUp(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- begin
- if ( IconDragging or BitmapDragging ) then
- begin
- if IconDragging then TheMouseManager.EndIconCursor( X , Y );
- if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
- IconDragging := false;
- BitmapDragging := false;
- Invalidate;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn1MouseUp(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- var CurrentName , { Holds work name}
- WorkingDir ,
- TheOldString : String; { Holds Dir }
- TargetDir : String; { target of op }
- TheResult : Integer; { Modal res hold }
- Counter_1 : Integer;
- begin
- If ( IconDragging or BitmapDragging )then
- begin
- if IconDragging then TheMouseManager.EndIconCursor( X , Y );
- if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
- IconDragging := false;
- BitmapDragging := false;
- with GlobalSource as TFileIconPanel do
- begin
- { Get current directory and save it for later }
- GetDir( 0 , TheOldString );
- { Display the Windows-based directory input form }
- TheResult := DestDDForm.ShowModal;
- { If not cancelled do the copy }
- if TheResult = mrOK then
- begin
- CurrentName := FTheName;
- { Get the target directory with \ OK }
- TargetDir := DestDDForm.GetTargetDirectory;
- { If a directory signal and do recursive operation }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
- +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
- begin
- ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
- TargetDir );
- end;
- end
- else
- begin
- { Do the copy }
- Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
- end;
- { Reset to the original directory }
- ChDir( TheOldString );
- end
- else Invalidate;
- end;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn2MouseUp(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- var CurrentName , { Holds work name}
- WorkingDir ,
- TheOldString : String; { Holds Dir }
- TargetDir : String; { target of op }
- TheResult : Integer; { Modal res hold }
- Counter_1 : Integer;
- begin
- If ( IconDragging or BitmapDragging )then
- begin
- if IconDragging then TheMouseManager.EndIconCursor( X , Y );
- if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
- IconDragging := false;
- BitmapDragging := false;
- with GlobalSource as TFileIconPanel do
- begin
- { Get current directory and save it for later }
- GetDir( 0 , TheOldString );
- { Display the Windows-based directory input form }
- TheResult := DestDDForm.ShowModal;
- { If not cancelled do the copy }
- if TheResult = mrOK then
- begin
- { Get the target directory with \ OK }
- TargetDir := DestDDForm.GetTargetDirectory;
- { If Copyfile returns false an error occurred }
- CurrentName := FTheName;
- { If a directory signal and do recursion }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
- '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
- ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
- TargetDir );
- end
- else
- begin { Do the move }
- Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
- ChDir( TheOldString );
- end;
- { Refresh display }
- ScrollBox1.Update;
- end
- else Invalidate;
- end;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn3MouseUp(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- var WorkingDir ,
- CurrentName : String; { Holds work name}
- Counter_1 : Integer;
- begin
- If ( IconDragging or BitmapDragging )then
- begin
- if IconDragging then TheMouseManager.EndIconCursor( X , Y );
- if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
- IconDragging := false;
- BitmapDragging := false;
- with GLobalSource as TFileIconPanel do
- begin
- CurrentName := FTheName;
- { If its a directory signal and do recursive delete }
- if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
- begin
- if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
- mbYesNoCancel , 0 ) = mrYes then
- begin
- Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
- Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
- end
- else Invalidate;
- end
- else
- begin
- { Otherwise get confirmation message and if OKed delete file }
- if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
- mbYesNoCancel , 0 ) = mrYes then
- begin
- Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
- end
- else Invalidate;
- end;
- { Refresh Display }
- Scrollbox1.Update;
- end;
- end;
- end;
-
- procedure TCCFileMgrForm.BitBtn4MouseUp(Sender: TObject;
- Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
- var WorkingDir ,
- CurrentName : String; { Holds work name}
- Counter_1 : Integer;
- begin
- If ( IconDragging or BitmapDragging )then
- begin
- if IconDragging then TheMouseManager.EndIconCursor( X , Y );
- if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
- IconDragging := false;
- BitmapDragging := false;
- with GlobalSource as TFileIconPanel do
- begin
- CurrentName := FTheName;
- { If a directory signal error }
- { Otherwise set up the opendialog with filename and caption }
- OpenDialog2.Filename := ExtractFilename( CurrentName );
- { Use this to prevent error from changing directories }
- OpenDialog2.Options := [ofNoChangeDir];
- OpenDialog2.Title := 'Rename File';
- { If not cancelled then do rename or signal error }
- if OpenDialog2.Execute then
- begin
- Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
- end
- else Invalidate;
- { Refresh the display }
- ScrollBox1.Update;
- end;
- end;
- end;
-
- end.
-